package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 流程配置表
 */
@Entity
@Table
public class ProcessConfig implements Serializable{
	
	private static final long serialVersionUID = 6902165755956779023L;
	private Integer code;
	private Integer rc;				// 角色编号
	private Integer pc;				// 流程序号
	private Byte business;			// 业务名称(1.物品申请流程2.请假申请流程，3用车申请流程,4.报销流程，5.离职流程，6.负责人请假离职流程)
	private Integer oc;				// 机构编号
	private Integer cu;				// 创建人
	private Boolean deleted;		// 是否删除
	private Date ct;				// 创建时间
	
	private String cn;				// 创建人名称
	private String rn;				// 角色名称
	private String on;				// 机构名称
	
	
	private List<ProcessConfig> itemList;
	
	
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getRc() {
		return rc;
	}
	@Column
	public Integer getPc() {
		return pc;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Formula("(SELECT r.name FROM Role r WHERE r.code = rc)")
	public String getRn() {
		return rn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCn() {
		return cn;
	}
	@Transient
	public List<ProcessConfig> getItemList() {
		return itemList;
	}
	@Column
	public Byte getBusiness() {
		return business;
	}
	
	
	
	public void setBusiness(Byte business) {
		this.business = business;
	}
	public void setItemList(List<ProcessConfig> itemList) {
		this.itemList = itemList;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setRc(Integer rc) {
		this.rc = rc;
	}
	public void setPc(Integer pc) {
		this.pc = pc;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setRn(String rn) {
		this.rn = rn;
	}
	public void setOn(String on) {
		this.on = on;
	}

}
